// Sql_DataBase.h: interface for the CSql_DataBase class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_SQL_DATABASE_H__F0F456ED_DDDE_45E1_8798_59EC0E75E2E2__INCLUDED_)
#define AFX_SQL_DATABASE_H__F0F456ED_DDDE_45E1_8798_59EC0E75E2E2__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "Platform_Interface.h"

class CSql_DataBase  
{
public:
	CSql_DataBase();
	virtual ~CSql_DataBase();
	
	int  ConnectDataSource( CString& strDataSource,CStringArray& tableArray );
	BOOL isConnectValid(void);
	BOOL isDBsourceValid();
	BOOL isTableExisting ( CStrings vTable, CStrings& errString );
	void Disconnect();
	
	BOOL BeginTrans   (void);
	BOOL CommitTrans  (void);
	BOOL RollbackTrans(void);
	CStrings GetFieldType( DWORD theType );
	
	BOOL MoveNext();
	BOOL MovePrevious();
	BOOL MoveLast();
	BOOL MoveFirst();

    BOOL ExecuteSQL      ( CStrings const &sSql,CStrings &sResult );
	BOOL SQLCommand      ( CStrings theSqlSentence , CStrings& theStatus, int& effectCount );
	BOOL ServerExecuteSQL( CStrings &theSqlSentence, CStrings& theStatus );
	
	int  GetRecordCount( CStrings& tableName );
	int  GetRecordCount();

	BOOL GetKeyFromDB( CStrings sName, CStrings &sKey );
	BOOL GetFieldValueStr( CStrings& strValue, CStrings strFieldName );
	BOOL GetFieldValueStr( CStrings& strValue, int lFieldIndex );

};

#endif // !defined(AFX_SQL_DATABASE_H__F0F456ED_DDDE_45E1_8798_59EC0E75E2E2__INCLUDED_)
